export default {
	goPage(url, data) {
		let web = url
		//有传参数
		if (data) {
			let arr = []
			for (let key in data) {
				arr.push(
					key + '=' + JSON.stringify(data[key])
				)
			}
			web = url + "?" + arr.join("&")
		}
		console.log("处理后的url：" + web);
		uni.navigateTo({
			url:web,
			complete(res) {
				console.log("res: ",res);
			}
		})		
	},

	checkNull(...object) {
		let result = true;
		object.forEach(item => {
			if (item === undefined || item === null || item === "" ||
				item === "undefined" || item !== item || item === "[]") {
				result = false;
			}
		})
		return result;
	},

	blur1(reg_tel) {
		if (reg_tel === '') {
			callback1(new Error('手机号不可为空'));
		} else {
			if (reg_tel !== '') {
				var reg = /^1[3456789]\d{9}$/;
				if (!reg.test(reg_tel)) {
					callback(new Error('请输入有效的手机号码'));
				} else {
					return true
				}
			}
			// callback();
		}

		function callback1(Error) {
			uni.showToast({
				title: '手机号码不能为空',
				icon: 'none'
			});

		}

		function callback(Error) {
			uni.showToast({
				title: '请输入有效的手机号码',
				icon: 'none'
			});
			return false
		}

	}
}
